package applet;

public class SoundPlay2 {
	SoundThread2 soundThread;
	Thread thread;

	public void init() {
		soundThread = new SoundThread2();
		thread = new Thread(soundThread);
		thread.start();
	}

	public void play() {
		synchronized (soundThread) {
			soundThread.isPlay = true;
			soundThread.notifyAll();
		}
	}

	public void stop() {
		soundThread.isPlay = false;
	}

	public static void main(String args[]) {
		SoundPlay2 sp = new SoundPlay2();
		sp.doit();
	}

	private void doit() {
		this.init();
		this.play();
		synchronized (this) {
			try {
				this.wait(3000);
			} catch (InterruptedException e) {

				e.printStackTrace();
			}
		}
		this.stop();
		synchronized (this) {
			try {
				this.wait(3000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		this.play();
		synchronized (this) {
			try {
				this.wait(3000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		this.stop();
	}
}
